import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:xmshop/app/utils/CommonUtils.dart';

String TAG = '[HomeController]';

class HomeController extends GetxController {
  //TODO: Implement HomeController
  List<RxInt> list = [];

  final count = 0.obs;
  final ScrollController scrollController = ScrollController();
  final RxBool overThreshold = false.obs;

  @override
  void onInit() {
    super.onInit();
    list = List.generate(19, (index) => (index + 1).obs).obs;
    scrollController.addListener(() {
      double offsetY = scrollController.position.pixels;
      clog(TAG, 'onInit-position:', scrollController.position.pixels);
      if (offsetY > 30) {
        overThreshold.value = true;
        update();
      } else {
        overThreshold.value = false;
        update();
      }
    });
  }

  @override
  void onReady() {
    super.onReady();
  }

  @override
  void onClose() {
    super.onClose();
  }

  void increment() => count.value++;
}
